/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - core/memory
// Copyright( c) 2013.  All Rights Reserved
//
// File:		AEMallocAllocator.h
// Author:		Gianluca Belardelli
// Date:		31/12/2013
//
/////////////////////////////////////////////////////////////////////////
#ifndef _AEMALLOCALLOCATOR_H_
#define _AEMALLOCALLOCATOR_H_

class AE_COREDLLIMPEXP AEMallocAllocator : public AEMemoryAllocator
{
// Members
private:
	AEMemStats			m_msStats;

protected:
public:

// Methods
private:
protected:
public:
	AE_DECLARE_SINGLETON( AEMallocAllocator );

	~AEMallocAllocator( void );

	/// Nelle statistiche di utilizzo della memoria, l'allocatore AEMallocAllocator
	/// indica quante malloc sono state effettuate nel campo uiTotalAvailable della
	/// struttura AEMemStats
	void *BlockAlloc( AEUINT32 uiNumBytes, AEMemoryAlign maAlign = AEMEM_ALIGN16 );

	/// Free numBytes. This method needs to handle p being null, as well
	/// as matching the handling of zero byte allocations as described in blockAlloc.
	void BlockFree( void *lpPtr, AEUINT32 uiNumBytes );

	void GetMemoryStats( AEMemStats &msMemStats );
	virtual AEINT32 GetAllocatedSize( const void *lpObj, AEINT32 nBytes );
};

#endif // _AEMALLOCALLOCATOR_H_